package gui.tables;

import gui.abstracts.AbstractTable;
import gui.tables.models.MyTableModel;

import java.util.Vector;


import javax.swing.DefaultListSelectionModel;
import javax.swing.table.DefaultTableModel;



public class TableStudent extends AbstractTable {
	private String [] columns ={"IdStudent","Nume","Prenume","Telefon"};
	public TableStudent() {

		tableMOdel = new MyTableModel();

		tableMOdel.addColumn(columns[0]);
		tableMOdel.addColumn(columns[1]);
		tableMOdel.addColumn(columns[2]);
		tableMOdel.addColumn(columns[3]);
		this.setModel(tableMOdel);
	}
	
	public void insertRowInTable(){
		tableMOdel.insertRow(this.getRowCount(),new Object[] { "", "", "", "" });
		((MyTableModel) tableMOdel).setLastRow(this.getRowCount()-1);
		((MyTableModel) tableMOdel).setInsertNewRow(true);
		
	}
	
	public void deleteAllDataFromTable(){
		while (tableMOdel.getRowCount() > 0) {
			tableMOdel.removeRow(0);
		}
	}
}
